package cn.edu.scau.cmi.huangxiyan.client;

import org.springframework.context.ApplicationContext;

import cn.edu.scau.cmi.huangxiyan.spring.domain.Student;
import cn.edu.scau.cmi.huangxiyan.spring.util.ApplicationContextUtil;

public class SpringSingletonApplicationContextClient {
	private static Student zhangsan;

	public static void main(String[] args) {
		ApplicationContext ac = getApplicationContext();
		zhangsan = (Student) ac.getBean("zhangsan");
		System.out.println(zhangsan.getName() + "的毕业设计指导导师是：" + zhangsan.getTutor().getName());
	}

	private static ApplicationContext getApplicationContext() {
		ApplicationContext applicationContext = ApplicationContextUtil.getApplicationContext();
		return applicationContext;
	}

}
